package com.bdyc.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Set;

import com.alibaba.fastjson.JSON;
import com.bdyc.util.MyDateFormat;

public class App2 {
//	@Test
	public void app1(){
		System.out.println(new Date());
		System.out.println(MyDateFormat.getFromatDate(new Date()));
		String a = MyDateFormat.getStringDate(new Date());
		System.out.println(a);
	}
	@SuppressWarnings("unchecked")
//	@Test
	public void testJson()
	{
		String text ="{\"1\": {\"w\":\"5\",\"j\":4},\"2\": {\"w\":\"5\",\"j\":4}}";
		Map<String,Object> map = (Map<String, Object>) JSON.parseObject(text, Map.class);
		Set<String> s = map.keySet();
		for (String string : s) {
			//System.out.println(map.get(string).toString());
			MySort ms = JSON.parseObject(map.get(string).toString(), MySort.class);
			//TODO 这里处理
			System.out.println(ms);
		}
	}
	public static  Long getDate(String dateString) throws ParseException{
		//先把字符串转成Date类型
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		//此处会抛异常
//		Date date = sdf.parse("2012-05-05 10:20:30");
		Date date = sdf.parse(dateString);
		//获取毫秒数
		long longDate = date.getTime();
		System.out.println(longDate);
		return longDate;
		//1336184490000  
		//1336184430000
	}
}
